package com.cy.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

/**
 * @ClassName ProviderController
 * @Description:类描述
 * @Author Tedu
 * @Date 2021/6/1 10:43
 * @Version V1.0
 **/
@RestController
public class ProviderController{
    @Value("${server.port}")
    private String server;

    /**
     * @Description: 方法描述
     * @Author: Tedu
     * @Date: 2021/5/29 14:03
     * @Param: [string]
     * @Return: java.lang.String
     */

    @GetMapping(value = "/provider/echo/{string}")
    public String doEcho(@PathVariable String string, HttpServletRequest request){
        Enumeration<String> headerNames = request.getHeaderNames();
        System.out.println(headerNames);
        while (headerNames.hasMoreElements()){
            System.out.println(headerNames.nextElement());
        }
        return server+"say:Hello Nacos discovery"+string;
    }
}